#define _CRT_SECURE_NO_WARNINGS 1
#include<vector>
using namespace std;
class Solution {
	int numcost[1001];
public:
	int minCostClimbingStairs(vector<int>& cost) {
		numcost[0] = cost[0];
		numcost[1] = cost[1];

		for (int i = 2; i<cost.size(); i++){
			if (numcost[i - 2] <= numcost[i - 1]){
				numcost[i] = numcost[i - 2] + cost[i];
			}
			else{
				numcost[i] = numcost[i - 1] + cost[i];
			}
		}

		return numcost[cost.size() - 1];
	}
};

int main()
{
	vector<int>cost;
	cost.push_back(2);
	cost.push_back(2);
	cost.push_back(1);
	cost.push_back(0);

	Solution s;
	s.minCostClimbingStairs(cost);

	return 0;
}